<script setup>
import zhCn from "element-plus/es/locale/lang/zh-cn";
import { useDataStore } from "../src/store/index"; // 引入 Pinia store

import { onMounted } from "vue";
import { useRoute } from "vue-router";
const route = useRoute();
const dataStore = useDataStore();

onMounted(() => {
  // 全局加载逻辑
  // 字典数据
  dataStore.fetchData();
  // console.log(route.meta.keepAlive);
});
</script>

<template>
  <div style="height: 100%; width: 100%">
    <el-config-provider :locale="zhCn">
      <router-view v-slot="{ Component }">
        <template v-if="route.meta.keepAlive">
          <keep-alive>
            <component :is="Component" />
          </keep-alive>
        </template>
        <template v-else>
          <component :is="Component" />
        </template>
      </router-view>
    </el-config-provider>
  </div>
</template>

<style scoped>
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
